import React, { Component } from 'react'

export default class App extends Component {
  state = {
    age: 18,
  }
  handleClick = () => {
    this.setState({
      age: this.state.age + 1,
    })
    this.setState({
      age: this.state.age + 2,
    })
    this.setState({
      age: this.state.age + 3,
    })
    /* {
        age: this.state.age + 1,
        age: this.state.age + 2,
        age: this.state.age + 3,
    } */
    console.log(this.state.age) // 18!
  }
  render() {
    console.log('render')
    return (
      <div>
        <p>{this.state.age}</p>
        <button onClick={this.handleClick}>click</button>
      </div>
    )
  }
}
